package com.findviewbydream.evil.helloyouth.User.Login;

import android.annotation.TargetApi;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.MotionEvent;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ScrollView;

import com.findviewbydream.evil.helloyouth.BaseActivity;
import com.findviewbydream.evil.helloyouth.R;
import com.findviewbydream.evil.helloyouth.Utils.SLog;
import com.findviewbydream.evil.helloyouth.Utils.SToast;


/********************************************
 * 工程名：HelloYouth
 * 包名：com.findviewbydream.evil.helloyouth.User.Login
 * 时间：16-6-28 下午7:51
 * 作者：白雨濃 evil
 * 邮箱：evilbai@foxmail.com
 * 内容：
 ********************************************/
public class Login extends BaseActivity
{
    private ScrollView scrollView;
    private LinearLayout linearLayout;


    @TargetApi(Build.VERSION_CODES.M)
    @Override
    public void initContentView(Bundle savedInstanceState)
    {
        super.setTitle("登陆");
        setContentView(R.layout.login);
        initView();

        linearLayout.setOnTouchListener(new View.OnTouchListener()
        {
            float y = 0;

            @Override
            public boolean onTouch(View view, MotionEvent motionEvent)
            {
                switch (motionEvent.getAction())
                {
                    case MotionEvent.ACTION_DOWN:
                        y = motionEvent.getY();
                        SLog.print("按下" + y);
                        break;
                    case MotionEvent.ACTION_MOVE:
                        SLog.print("抬起" + motionEvent.getY());
                        if (y - motionEvent.getY() > 10)
                        {
                            SLog.print("滑动");
                            scrollView.smoothScrollTo(0, scrollView.getMeasuredHeight());
                        }
                        break;
                }
                return true;
            }
        });
    }

    private void initView()
    {
        scrollView = (ScrollView) findViewById(R.id.scrollView);
        linearLayout = (LinearLayout) findViewById(R.id.linearLayout);
    }
}














